﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MainTabControl.ascx.cs"
    Inherits="WebApplication.UserControl.MainTabControl" %>
<script type="text/javascript">
    //    $(document).ready(function () {
    //        $("#" + tbselect).attr("class", "selected");
    //
    //    })

    var url_param = '<% = url_param %>'; //js获取cs后端的变量url_param

    //菜单数组
    var tb2arr = []
    if (url_param == "false") {
        tb2arr = [
        { id: "t1", href: "../Basicinformation.aspx", label: "Basic Information", width: 130,class:''},
        { id: "t2", href: "" , label: "Address &amp; Contact Information", width: 210,class:'disabled' },
        { id: "t3", href: "", label: "Contact Person", width: 130, class: 'disabled' },
        { id: "t5", href: "", label: "Business Nature", width: 135, class: 'disabled' },
        { id: "t8", href: "", label: "Branch Office", width: 115, class: 'disabled' },
        { id: "t21", href: "", label: "Brand", width: 80, class: 'disabled' },
        { id: "t6", href: "", label: "Product Category", width: 145, class: 'disabled' },
        { id: "t7", href: "", label: "Main Market", width: 115, class: 'disabled' },
        { id: "t22", href: "", label: "Product Information", width: 175, class: 'disabled' },
        { id: "t4", href: "", label: "Web Login", width: 105, class: 'disabled' },
        { id: "t23", href: "", label: "Media Room", width: 125, class: 'disabled' },
        { id: "t24", href: "", label: "Log", width: 105, class: 'disabled'}]
    }
    else {
        tb2arr = [
        { id: "t1", href: "../Basicinformation.aspx" + url_param, label: "Basic Information", width: 130 ,class:''},
        { id: "t2", href: "../AddressContactInformation.aspx" + url_param, label: "Address &amp; Contact Information", width: 210, class: '' },
        { id: "t3", href: "../ContactPerson.aspx" + url_param, label: "Contact Person", width: 130, class: '' },
        { id: "t5", href: "../Businessnature.aspx" + url_param, label: "Business Nature", width: 135, class: '' },
        { id: "t8", href: "../BranchOffice.aspx" + url_param, label: "Branch Office", width: 115, class: '' },
        { id: "t21", href: "../Brand.aspx" + url_param, label: "Brand", width: 80, class: '' },
        { id: "t6", href: "../ProductCategory.aspx" + url_param, label: "Product Category", width: 145, class: '' },
        { id: "t7", href: "../MainMarket.aspx" + url_param, label: "Main Market", width: 115, class: '' },
        { id: "t22", href: "../ProductInformationForm.aspx" + url_param, label: "Product Information", width: 175, class: '' },
        { id: "t4", href: "../WebLogin.aspx" + url_param, label: "Web Login", width: 105, class: '' },
        { id: "t23", href: "../MediaRoomImg.aspx" + url_param, label: "Media Room", width: 125, class: '' },
        { id: "t24", href: "../CustomerLog.aspx" + url_param, label: "Log", width: 105, class: ''}]
    }

    //填充菜单
    function paddingTab() {
        $("#tab li").remove();
        $("#tb2 li").remove();
        var w = document.body.clientWidth;
        // var min = 10; //mini 820     
        var nl = 50; //now width;   
        for (i = 0; i < tb2arr.length; i++) {
            l = tb2arr[i].width;
            css = tb2arr[i].class == "" ? " " : 'class=\"' + tb2arr[i].class + '\"';
            hr=tb2arr[i].href==''?'':'href=\"' + tb2arr[i].href +  '\" ';
           // var str = '<li id=\"' + tb2arr[i].id + '\"><span><a href=\"' + tb2arr[i].href +  '\" '+ css + '>' + tb2arr[i].label + '</a></span></li>';
            var str = '<li id=\"' + tb2arr[i].id + '\"><span><a '+hr+ css + '>' + tb2arr[i].label + '</a></span></li>';
                     

            if (nl < w && (nl + l) < w) {
                nl = nl + l;
                jQuery(str).appendTo("#tab");
            } else {
                jQuery(str).appendTo("#tb2");
            }

        }
        var tbselect = $("#pageName").val();
        $("#" + tbselect).attr("class", "selected");
    }



    $(document).ready(function () {
        paddingTab(); //填充菜单
        //页面缩放时
        $(window).resize(function () {
            paddingTab();
        });

    })
  

</script>
<div class="tab-wrap">
    <div class="leftbtn">
        <img src="../Media/Css/images/001_27.png" alt="" height="24" />
    </div>
    <ul class="tab" id="tab">
    </ul>
    <div class="rightbtn" id="rightbtn">
        <img src="../Media/Css/images/maintab2btn.png" alt="" height="24" />
        <ul class="tb2" id="tb2">
        </ul>
    </div>
</div>
<%--  
       <li id="t1"><span><a href="../Basicinformation.aspx">Basic Information</a></span></li>	
	  <li id="t2"><span><a href="../AddressContactInformation.aspx">Address &amp; Contact Information</a></span></li>      	
	  <li id="t3"><span><a href="../ContactPerson.aspx">Contact Person</a></span></li>
      <li id="t4"><span><a href="../WebLogin.aspx">Web Login</a></span></li>
	  <li id="t5"><span><a href="../Businessnature.aspx">Business Nature</a></span></li>
	  <li id="t6"><span><a href="../ProductCategory.aspx">Product Category</a></span></li>       
      
        <li id="t7"><span><a href="../MainMarket.aspx">Main Market</a></span></li>
            <li id="t8"><span><a href="../BranchOffice.aspx">Branch Office</a></span></li>	
            <li id="t21"><span><a href="../Brand.aspx">Brand</a></span></li>
			<li id="t22"><span><a href="../ProductInformationForm.aspx">Product Information</a></span></li>	
			<li id="t23"><span><a href="../MediaRoomImg.aspx">Media Room</a></span></li>			
			<li id="t24"><span><a href="../CustomerLog.aspx">Log</a></span></li>			--%>
